<template>
  <!-- 单据配件合并结果 -->
  <div>
    <FilterTable
      ref="table"
      :columns="columns"
      columnsRef="partPartPurchasePurchaseOrderCreateMergeBillPartResult"
      :dataSource="partList"
      :isMemoryPagination="true"
      :isSelectColumn="false"
      :onColumnsChange="columns => (this.columns = columns)"
    ></FilterTable>
    <div class="btnWrap">
      <el-button @click="handleCancle">取 消</el-button>
      <el-button type="primary" @click="handleConfirm">确 定</el-button>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    partList: {
      type: Array,
      default: []
    }
  },
  data() {
    return {
      columns: this.createTableColumns()
    };
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '配件代码',
          dataIndex: 'partNo',
          width: 150,
          showOverflowTooltip: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '配件名称',
          dataIndex: 'partName',
          width: 150,
          showOverflowTooltip: true,
          filter: true,
          filterType: 'input'
        },
        // {
        //   title: '厂家配件代码',
        //   dataIndex: 'a5'
        // },
        {
          title: '计划数量',
          dataIndex: 'nOrderQty',
          filter: true,
          filterType: 'number'
        },
        {
          title: '主组号',
          dataIndex: 'mainGroupNo',
          filter: true,
          filterType: 'input'
        }
      ];
    },
    // 点击确定
    handleConfirm() {
      this.$emit('onConfirm', this.partList);
      this.handleCancle();
    },
    handleCancle() {
      this.$emit('close');
    }
  }
};
</script>

<style scoped>
.btnWrap {
  position: absolute;
  left: 0px;
  bottom: 0px;
  right: 0px;
  z-index: 9;
  border-top: 1px solid rgb(233, 233, 233);
  padding: 10px 20px;
  background: rgb(255, 255, 255);
  text-align: right;
}
</style>
